﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="UploadFiles.aspx.cs" Inherits="Cms.Web.UI.Admin.UploadFiles" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" src="/swfupload/swfupload.js"></script>
    <script type="text/javascript" src="/swfupload/swfupload.cookies.js"></script>
    <script type="text/javascript" src="/swfupload/swfupload.queue.js"></script>
    <script type="text/javascript" src="/swfupload/Handlers.js"></script>
    <script type="text/javascript" src="/swfupload/FileProgress.js"></script>
    <link type="text/css" rel="Stylesheet" href="Admin/Css/SwfUpload.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="buttons" runat="server">
    <asp:hyperlink ID="hlCancel" runat="server" CssClass="orangeButton"><span><span><img src="Admin/Img/icons/delete.png" alt="" /><span><cms:LocalizedLiteral ID="llCancel" runat="server" /></span></span></span></asp:hyperlink>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="tabs" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="body" runat="server">
    <asp:Literal ID="litIcon" runat="server" Visible="false" Text="Admin/Img/Icons/folder_up.png" />
    <div style="margin-bottom: 10px;"><cms:LocalizedLiteral ID="llCurrentFolder" runat="server" />: <asp:Literal ID="litFolder" runat="server" /></div>
    <div id="SwfUploadPlaceholder"></div>
    
    <div id="divFileProgressContainer" style="font-family: Tahoma; font-size: 12px;"></div>

    <input id="btnCancel" type="button" value="Cancel Uploads" onclick="cancelQueue(upload1);" disabled="disabled" style="display: none; margin-left: 2px; height: 22px; font-size: 8pt;" />

    <div id="overwriteWarning" style="position: absolute; left: -10000px;">
        <p><cms:LocalizedLiteral ID="llOverwriteMessage" runat="server" />:</p>
        <p><span id="lblExistingFiles"></span></p>
        <p><cms:LocalizedLiteral ID="llOverwriteQuestion" runat="server" /></p>
    </div>

    <iframe id="ifrCheckFiles" runat="server" style="position: absolute; left: -10000px;"></iframe>
    
    <script type="text/javascript">
        //<![CDATA[
        function showOverlay() {
            var queuedFiles = document.getElementById("queuedFiles");
            var overlay = document.getElementById("overlay");
            var mainBox = document.getElementById("mainBox");
            var selectFiles = document.getElementById("selectFiles");
            selectFiles.style.display = "none";
            overlay.style.left = iLib.Pos.FindX(queuedFiles) - iLib.Pos.FindX(mainBox) + "px";
            overlay.style.top = iLib.Pos.FindY(queuedFiles) - iLib.Pos.FindY(mainBox) + "px";
            overlay.style.width = queuedFiles.offsetWidth + "px";
            overlay.style.height = queuedFiles.offsetHeight + "px";
            overlay.style.display = "block";
        }

        var swfu;

        function initSwfUpload() {
            swfu = new SWFUpload({
                upload_url: "ProcessUploadedFile.aspx",
                flash_url: "../SwfUpload/swfupload.swf",
                post_params: {
                    "ASPSESSID": "<%=Session.SessionID%>",
                    "FrediumAuth": "<% =Request.Cookies["FrediumAuth"] != null ? Request.Cookies["FrediumAuth"].Value : ""%>"
                },

				// Button settings
                button_placeholder_id: "SwfUploadPlaceholder",
                button_image_url: "../Admin/Img/UploadButtonSv.png",
				button_width: 123,
				button_height: 24,
				button_text: '<span class="orangeButtonText">Select files</span>',
				button_text_style: '.orangeButtonText {	font-family: Tahoma, Arial, Sans-serif; font-size: 12px; color: #444455; }',
				button_text_top_padding: 3,
				button_text_left_padding: 27,
				button_cursor: SWFUpload.CURSOR.HAND,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,

				file_size_limit: "102400", // 100MB
				file_types: "*.*",
				file_types_description: "All Files",
				file_upload_limit: "10",
				file_queue_limit: "0",

				// Event Handler Settings (all my handlers are in the Handler.js file)
				file_dialog_start_handler: fileDialogStart,
				file_queued_handler: fileQueued,
				file_queue_error_handler: fileQueueError,
				file_dialog_complete_handler: fileDialogComplete,
				upload_start_handler: uploadStart,
				upload_progress_handler: uploadProgress,
				upload_error_handler: uploadError,
				upload_success_handler: uploadSuccess,
				upload_complete_handler: uploadComplete,

				custom_settings: {
				    progressTarget: "divFileProgressContainer",
                    cancelButtonId: "btnCancel"
				},
				// Debug Settings
				debug: false
            });
        }

        function validationCallback(status) {
            if (status == "ok") {
                startProcessingFiles();
            }
            else
                swfu.cancelQueue();              
        }

        iLib.Dom.AddListener(window, "load", initSwfUpload);
        
        //]]>
    </script>
</asp:Content>
